<#import "/layout/mainLayout.html" as mainLayout />

<#macro mainheading>

</#macro>
<#assign mainheading = mainheading in mainLayout />

<#macro maincontent>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div class="col-xs-8">
                        <div class="box-primary">
                            <!-- form start -->
                            <form id="pricetagform" class="form-horizontal" method="post"
                                  enctype="multipart/form-data">
                                <div class="" box-body id="box-body">

                                    <div class="form-group">
                                        <label for="pricetag_name" class="col-sm-2 control-label">名称
                                        </label>
                                        <div class="col-sm-4">
                                            <input type="hidden" name="pricetag_id" id="pricetag_id">
                                            <input type="text" class="form-control"
                                                   name="pricetag_name"
                                                   id="pricetag_name"
                                                   value="${pricetag.fName}"
                                                   placeholder="名称">
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <label for="pricetag_money" class="col-sm-2 control-label">人民币
                                        </label>
                                        <div class="col-xs-3">
                                            <input type="text" class="form-control"
                                                   name="pricetag_money" placeholder="人民币"
                                                   value="${pricetag.fMoney}"
                                                   id="pricetag_money" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="pricetag_coin" class="col-sm-2 control-label">零钱
                                        </label>
                                        <div class="col-xs-3">
                                            <input type="text" class="form-control"
                                                   name="pricetag_coin" placeholder="零钱"
                                                   value="${pricetag.fCoin}"
                                                   id="pricetag_coin" >
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <label for="pricetag_offday"
                                               class="col-sm-2 control-label">观看天数
                                        </label>
                                        <div class="col-xs-3">
                                            <input type="text" class="form-control"
                                                   name="pricetag_offday" placeholder="观看天数"
                                                   value="${pricetag.fOffday}"
                                                   id="pricetag_offday" >
                                        </div>
                                    </div>
                                    <div class="form-group">

                                        <label for="pricetag_desc" class="col-sm-2 control-label">
                                            描述</label>
                                        <div class="col-sm-4">
                                            <textarea class="form-control" name="pricetag_desc" rows="3" placeholder="描述 ..."
                                                      id="pricetag_desc"></textarea>
                                        </div>
                                    </div>

                                </div><!-- /.box-body -->
                                <div class="box-footer">
                                    <button type="button" class="btn btn-info pull-right"
                                            onclick="updatePriceTag()">修改
                                    </button>
                                </div><!-- /.box-footer -->
                            </form>
                        </div>
                    </div>
                </div><!-- /.box -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </section>

</#macro>
<#assign maincontent = maincontent in mainLayout />

<#macro mainfooter>
    <script src="/js/jquery/jquery.form.js"></script>

    <script type="text/javascript">
        var paramsId=$.getUrlParam("fid");
        if (paramsId){
            $('#pricetag_id').val(paramsId);
        }
        else {
            //   window.location.href='/admin/exp/index';
        }
        $('#pricetag_desc').val('${pricetag.fDesc}');

        function updatePriceTag() {

            if (!$('#pricetag_name').val()) {
                dialog({
                    title: '提示',
                    content: '请输入价格标签名称！',
                    cancel: false,
                    ok: function () {
                    }
                }).width(320).showModal();
                return;
            }

            var options = {
                url: '/api/price/pricetagupdate',
                type:'post',
                success: function (data) {
                    if (data) {
                        if (data.code=='OperateOk') {
                            dialog({
                                title: '提示',
                                content: '操作成功！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                        else {
                            dialog({
                                title: '提示',
                                content: '操作失败！',
                                cancel: false,
                                ok: function () {
                                }
                            }).width(320).showModal();
                        }
                    }
                }
            };
            $("#pricetagform").ajaxSubmit(options);
        }
    </script>
</#macro>
<#assign mainfooter = mainfooter in mainLayout />
<@mainLayout.page title="用户管理"/>